<html>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
var numFound = 0;
var page = 1;

$(function(){
	setInterval(getGameIds,2000);
});

function getGameIds() {
	output = "";
	$.get("getGames.php?page=" + page, function(data){
				
		var game = $("td.game a", $(data));
		$(game).each(function(i) {
			if(numFound >= 100) {
				return true;
			}
			var text = $(this).text().split(", ")[1];
			if(text != undefined && (text.indexOf('rank stabilized')!=-1  ||  text.indexOf('lone survivor')!=-1)) {
				
				var id = $(this).attr("href").split("?game=")[1];
				output += id + ",";
				numFound++;
			}
		});
		$("#output").append(output);
	});
	page++;
}


</script>
<body>
<div id="output"></div>
</body>
</html>